package com.example.first.services;

import com.example.first.modle.AddressBook;
import com.example.first.modle.ApiResponse;
import com.example.first.modle.CartItem;
import com.example.first.modle.Category;
import com.example.first.modle.Dish;
import com.example.first.modle.LoginRequest;
import com.example.first.modle.OrderSubmit;
import com.example.first.modle.OrderSubmitVO;
import com.example.first.modle.OrderVO;
import com.example.first.modle.Register;
import com.example.first.modle.ShoppingCart;
import com.example.first.modle.UsersVO;

import java.util.List;

import okhttp3.Address;
import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiService {

    //分类列表
    @GET("user/category/list")
    Call<ApiResponse<List<Category>>> getCategoryList(@Query("type") int type);

    //根据分类id查询菜品
    @GET("user/dish/list")
    Call<ApiResponse<List<Dish>>> getDishList(@Query("categoryId") int categoryId);

    //获取购物车数据
    @GET("user/shoppingCart/list")
    Call<ApiResponse<List<CartItem>>> getCartList();

    //注册
    @POST("user/user/register")
    Call<ApiResponse<String>> register(@Body Register register);

    //获取验证码
    @POST("user/user/sendMsg")
    Call<ApiResponse<String>> sendMsg(@Body String email);

    //登录
    @POST("user/user/login")
    Call<ApiResponse<String>> login(@Body LoginRequest loginRequest);

    //购物车加
    @POST("user/shoppingCart/add")
    Call<ApiResponse<String>> addCart(@Body ShoppingCart shoppingCart);

    //购物车减
    @POST("user/shoppingCart/sub")
    Call<ApiResponse<String>> subCart(@Body ShoppingCart shoppingCart);

    //购物车修改
    @POST("user/shoppingCart/update")
    Call<ApiResponse<String>> updateCart(@Body ShoppingCart shoppingCart);

    //更改用户头像接口
    @Multipart
    @POST("user/user/upload/image")
    Call<ApiResponse<String>> uploadImage(@Part MultipartBody.Part file);

    //更新背景图
    @Multipart
    @POST("user/user/upload/backgroundImage")
    Call<ApiResponse<String>> uploadBackgroundImage(@Part MultipartBody.Part file);

    //获取用户信息
    @GET("user/user")
    Call<ApiResponse<UsersVO>> getUserInfo();

    //获取当前登录用户的所有地址信息
    @GET("user/addressBook/list")
    Call<ApiResponse<List<AddressBook>>> getAddressList();

    //设为默认地址
    @PUT("user/addressBook/default")
    Call<ApiResponse<String>> setDefaultAddress(@Body AddressBook addressBook);

    //新增地址
    @POST("user/addressBook")
    Call<ApiResponse<String>> addAddress(@Body AddressBook addressBook);

    //修改地址
    @PUT("user/addressBook")
    Call<ApiResponse<String>> updateAddress(@Body AddressBook addressBook);

    //查询历史订单
    @GET("user/order/historyOrders/list")
    Call<ApiResponse<List<OrderVO>>> getHistoryOrders(@Query("orderStatus") Integer orderStatus);

    //再来一单
    @POST("user/order/repetition/{id}")
    Call<ApiResponse<String>> repetition(@Path("id") Long id);

    //用户下单接口
    @POST("user/order/submit")
    Call<ApiResponse<OrderSubmitVO>> orderSubmit(@Body OrderSubmit orderSubmit);

    //获取默认地址
    @GET("user/addressBook/default")
    Call<ApiResponse<AddressBook>> getDefaultAddress();

}
